package com.karrim.client.mvp.view;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.gwtplatform.mvp.client.ViewImpl;
import com.karrim.client.mvp.NameTokens;
import com.karrim.client.mvp.presenter.MainPresenter;

/**
 *
 * @author andrea.cantafio
 */
public class MainView extends ViewImpl implements MainPresenter.NView {

    @Inject
    public MainView() {
        pnl = new HTMLPanel(html);
        pnl.add(new Hyperlink("Vai a file", NameTokens.file));
    }

    public Widget asWidget() {
        return pnl;
    }

    @Override
    public void setInSlot(Object slot, Widget content) {
        if (slot == MainPresenter.TYPE_SET_MAIN_CONTENT) {
            pnl.clear();
            pnl.add(content);
        } else {
            super.setInSlot(slot, content);
        }
    }
    
    private HTMLPanel pnl;
    private static String html = "<h1>Test <b>HTML</b> content</h1>";
}
